package com.sds.shop.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import com.sds.fw.dao.AbDao;
import com.sds.shop.vo.CategoryVO;
import com.sds.shop.vo.DeliveryVO;

public class DeliveryDAO  extends AbDao {
	private static DeliveryDAO dDao = new DeliveryDAO();
	public static DeliveryDAO getInstance(){
		return dDao;
	}
	

	public ArrayList<DeliveryVO> getDeliveryList(){
		ArrayList<DeliveryVO> list = new ArrayList<DeliveryVO>();
		Connection conn = null;
		PreparedStatement ps = null;
		ResultSet rs = null;
		try{
			conn = connect();
			
			StringBuffer query = new StringBuffer();
			query.append("SELECT * FROM tb_DLV_CORP ");
			
			ps = conn.prepareStatement( query.toString() );

			rs = ps.executeQuery();
			while(rs.next()){
				DeliveryVO dvo = new DeliveryVO();
			    dvo.setDlvCorNo(rs.getString(1));
				dvo.setDlvCorpNm(rs.getString(2)); 
			    dvo.setBizNo(rs.getString(3));
			    dvo.setCeoNm(rs.getString(4));
			    dvo.setCeoTelNo(rs.getString(5));
			    dvo.setAddr(rs.getString(6));
			    dvo.setRegId(rs.getString(7));
			    dvo.setRegDtm(rs.getString(8));
			    
				list.add(dvo);
			}
			close(conn, ps, rs);
		}catch(Exception ex){
			System.out.println("getDeliveryList exception : " + ex);
			close(conn, ps, rs);
		}
		
		return list;
	} // getDeliveryList
	
	

}
